<?php //$Rev:: 23         $ // DO NOT REMOVE

error_reporting(E_ALL);

class IM_IN_ENC2 extends Parser
{
    public function parse($args, $obj)
    {
        $matches = explode(':', $args, 10);
        $data = array('screenname'      =>  $obj->core->aim_normalize($matches[0]),
                      'autoresponse'    =>  $matches[1] == 'T' ? true : false,
                      'unknown'         =>  $matches[3],
                      'message_text'    =>  trim(strip_tags($matches[8])),
                      'message_type'    =>  AIM_MSG_IM,
                      'message_alert'   =>  null);
        
        $obj->core->aim_debug('You have just recieved an IM from ' . $data['screenname'] . '' . (($data['autoresponse'] == true) ? ' (autoresponse)' : ''), AIM_RECV);

        // throttle
        if ($obj->core->throttle->check($data) === true) {
            // check for our away message callback
            if (!array_key_exists('away', $obj->core->handlers)) {
                throw new ATACException("The required callback for the 'away' alert is required by ATAC to run.  Please consult 'mod_standard.php' in your modules directory to fix the problem.");
            } else {
                // Issue the command
                if ($obj->core->away['isaway'] === true && $data['message_text'] != $obj->core->user['msgalert'] . 'away') {
                    $obj->core->utilities->aim_send_im($data['screenname'], $obj->core->away['message'], true, true);
                    // check for autoresponders (exclude admins;
                    // they're automatically disqualified, since we
                    // really can't add them to an autoresponder anyways)
                } elseif (array_key_exists($data['screenname'], $obj->core->buddy->autorespond)) {
                    if (!$obj->core->utilities->aim_is_admin($data['screenname'])) {
                        $obj->core->utilities->aim_send_im($data['screenname'], $obj->core->buddy->autorespond[$data['screenname']], true);
                    } else {
                        $obj->core->parser->aim_parse_im($data);
                    }
                } else {
                    $obj->core->parser->aim_parse_im($data);
                }
            }
        } // end throttle check
    }
}

?>